package treeNode;

/**
 * 最大深度，利用递归
 */
public class MaxLength {
    public int maxDepth(TreeNode root){
        if(root==null){
            return 0;
        }else{
            return Math.max(maxDepth(root.left),maxDepth(root.right))+1;
        }
    }

    public static void main(String[] args) {
        MaxLength maxLength = new MaxLength();
        System.out.println(maxLength.maxDepth(TreeNodeUtils.getTestTreeNode()));
    }

}
